package com.fengye.school.model.school.enums;

import lombok.Getter;

/**
 * 年级类型
 */
@Getter
public enum GradeType {
    FRESHMAN(1, "大一"), //大学一年级学生
    SOPHOMORE(2, "大二"), //大学二年级学生
    JUNIOR(3, "大三"), //大学三年级学生
    SENIOR(4, "大四"), //大学四年级学生
    GRADUATED_FIRST_YEAR(11, "研一"),
    GRADUATED_SECOND_YEAR(12, "研二"),
    GRADUATED_THIRD_YEAR(13, "研三"),
    DOCTOR_FIRST_YEAR(21, "博一"),
    DOCTOR_SECOND_YEAR(22, "博二"),
    DOCTOR_THIRD_YEAR(23, "博三"),
    DOCTOR_FOURTH_YEAR(24, "博四"),
    DOCTOR_FIFTH_YEAR(25, "博五"),
    DOCTOR_SIXTH_YEAR(26, "博六"),
    DOCTOR_SEVENTH_YEAR(27, "博七");
    private int code;
    private String name;

    GradeType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static GradeType getTypeFromName(String name) {
        for (GradeType type : GradeType.values()) {
            if (type.getName().equals(name)) {
                return type;
            }
        }
        return null;
    }
}
